<!DOCTYPE html> <!-- -*- html -*- -->
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="initial-scale=1, maximum-scale=1">
  <title>Vector addition</title>
  <link rel="shortcut icon" href="img/gatech.gif"/>

  
      <link rel="stylesheet" href="css/demo.css?vers=2759ff">
  

  <style>
      
  </style>

</head>
<body>
    

    
        <script src="js/demo.js?vers=77646a"></script>
    

    <script type="text/javascript">
        "use strict";
        DomReady.ready(function() {

        new Demo({
  mathbox: {
    mathbox: {
      warmup: 10,
      splash: false,
      inspect: false
    }
  },
  camera: {
    position: [-1.5, -3, 1.5]
  }
}, function() {
  var color1, color2, color3, colors, origins, update, vector1, vector2, vector3, vectors, view;
  window.mathbox = this.mathbox;
  view = this.view({
    axes: false
  });
  vector1 = [3, -5, 4];
  vector2 = [4, -1, -2];
  vector3 = [vector1[0] + vector2[0], vector1[1] + vector2[1], vector1[2] + vector2[2]];
  color1 = new Color("blue");
  color2 = new Color("green");
  color3 = new Color("red");
  origins = [[0, 0, 0], [0, 0, 0], vector2, vector1, [0, 0, 0]];
  vectors = [vector1, vector2, vector3, vector3, vector3];
  colors = [color1, color2, color1, color2, color3];
  this.labeledVectors(view, {
    vectors: vectors,
    origins: origins,
    colors: colors,
    labels: ['v', 'w', 'v', 'w', 'v+w']
  });
  this.draggable(view, {
    points: [vector1, vector2],
    onDrag: function(vec) {
      vec.clampScalar(-10, 10);
      vector3[0] = vector1[0] + vector2[0];
      vector3[1] = vector1[1] + vector2[1];
      vector3[2] = vector1[2] + vector2[2];
      return update();
    }
  });
  this.caption('<p><span id="vectors-here"></span></p>\n<p>[click and drag the heads of v and w to move them]</p>');
  this.vecElt = document.getElementById("vectors-here");
  update = (function(_this) {
    return function() {
      return katex.render(_this.texVector(vector1, {
        color: color1
      }) + "+" + _this.texVector(vector2, {
        color: color2
      }) + "=" + _this.texVector(vector3, {
        color: color3
      }), _this.vecElt);
    };
  })(this);
  return update();
});


        });
    </script>
</body>
</html>

